<?php include 'header.php';
				
 session_start();
 include 'conexaoMysql.php';
 $crud = new crud();

			if(isset ($_REQUEST['logar'])){
                            $email= $_REQUEST['email'];
                            $senha= $_REQUEST['senha'];
                            if($email !=""){
                                $sql = ("SELECT * FROM tbUsuarios WHERE tbUsuariosEmail='$email' AND tbUsuariosSenha= '$senha'");
                                $query=mysql_query($sql)  or die (mysql_error()); 
                                $qtda = mysql_num_rows ($query);
                                if($qtda==0){
                                    echo"<script>alert('Email ou Senha Incorretos');Location.href='logar.php'</script>"; 
                                }else{
                                    $dados = mysql_fetch_array($query);
                                    
                                    
                                    $_SESSION['email']= $email;
                                    $_SESSION['senha']= $senha;
                                    //$_SESSION['idEvento']= '';
                                    //$_SESSION['idCurso']='';
                                    $_SESSION['idUsuario']=$dados[0];
                                    
                                    if($dados[3] == 0)
                                        header("Location:seausuario/index.php");
                                    //var_dump($dados);
                                    
                                    if($dados[3] == 1)
                                    header("Location:sea/index.php");
                                }
                            }else{
                                echo"<script>alert('Email ou Senha Incorretos');Location.href='logar.php'</script>"; 
                            }
			}
			?>






  <!--<link rel="stylesheet" href="css/styleMenu.css">-->

  <section class="containerLogin">
    <div class="login">
      <h1>Entrar no sistema</h1>
      <form method="post" action="logar.php" name="cadastro" >
        <p><input type="email" name="email" value="" placeholder="Informe seu Email" required></p>
        <p><input type="password" name="senha" value="" placeholder="Senha" required></p>
        <p class="remember_me">
          
            <input type="checkbox" name="remember_me"  id="remember_me">
            Lembrar minha senha
        </p>
        <p class="submit"><input type="submit" name="logar" value="Logar"></p>
      </form>
      
      </div>
      
      <div class="login">
      <h1>Não sou Cadastrado</h1>
      <form method="post" action="cadastro.php" name="cadastro" >
        <p><input type="email" name="email" placeholder="Informe seu Email" required></p>
        
        <p class="submit"><input type="submit" name="logar" value="Cadastrar" ></p>
      </form>
    </div>
  </section>












                                <?php include 'footer.php'; ?>
				